package org.xg.study.pd.factory.impl;

import org.xg.study.pd.factory.ICacheAdapter;
import org.xg.study.pd.matter.EGM;

import java.util.concurrent.TimeUnit;

/**
 * @author CMG
 * @version 1.0
 * @cLassName EGMCacheAdapter
 * @description
 * @date 2021/9/9 13:55
 **/
public class EGMCacheAdapter implements ICacheAdapter {

    EGM egm = new EGM();

    @Override
    public String get(String key) {
        return egm.gain(key);
    }

    @Override
    public void set(String key, String value) {
        egm.set(key, value);
    }

    @Override
    public void set(String key, String value, long timeout, TimeUnit timeUnit) {
        egm.setEx(key, value, timeout, timeUnit);
    }

    @Override
    public void del(String key) {
        egm.delete(key);
    }
}
